home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / scp / scp_yacc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-23  |  24.3 KB  |  899 lines

  1. # define white_space_tok 257
  2. # define l_brc_tok 258
  3. # define r_brc_tok 259
  4. # define double_colon_tok 260
  5. # define semi_colon_tok 261
  6. # define l_par_tok 262
  7. # define r_par_tok 263
  8. # define l_br_tok 264
  9. # define r_br_tok 265
  10. # define operator_string_tok 266
  11. # define name_tok 267
  12. # define operator_tok 268
  13. # define string_tok 269
  14. # define char_tok 270
  15. # define number_tok 271
  16. # define special_tok 272
  17.  
  18. # line 65 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  19.  
  20. #include <malloc.h>
  21. #include <string.h>
  22. #include <stream.h>
  23.  
  24. #include "sys.h"
  25. #include "smg.h"
  26. #include "scp_err.h"
  27. #include "mta_use.h"
  28. #include "cci_use.h"
  29. #include "scp_yacc.h"
  30.  
  31. static sos_Bool   global_var_init         = FALSE; // 09.07.91 (bs)
  32. static int        nesting                 = 0;
  33. static char       *in_method_of_sos_class = 0;
  34. sos_Schema_module scp_mdl;
  35.  
  36. class string_elem
  37. {  char *s;
  38.    string_elem *next;
  39.    friend class strings;
  40.    friend ostream& operator<< (ostream&, strings&);
  41. };
  42.  
  43. class strings
  44. {  string_elem *first, *last;
  45.    friend ostream& operator<< (ostream&, strings&);
  46. public:
  47.    static strings make (char*);
  48.    char*& operator[](int);
  49.    strings& operator+ (strings&);
  50. };
  51.  
  52. strings strings::make (char *s1)
  53. {  strings result;
  54.    result.first=new string_elem;
  55.    result.first->s=s1;
  56.    result.first->next=0;
  57.    result.last=result.first;
  58.    return result;
  59. }
  60.  
  61. char*& strings::operator[](int i)
  62. {  string_elem *e = first;
  63.    for (; i; i--) e=e->next;
  64.    return e->s;
  65. }
  66.  
  67. strings& strings::operator+ (strings &s1)
  68. {  last->next=s1.first;
  69.    last=s1.last;
  70.    return *this;
  71. }
  72.  
  73. static ostream& operator<< (ostream& c, strings &s)
  74. {  string_elem *e, *e1;
  75.    e = s.first;
  76.    for (; e; e=e1)
  77.    {  e1 = e->next;
  78.       c << e->s;
  79.       c.flush();
  80.       delete e->s;
  81.       delete e;
  82.    }
  83.    return c;
  84. }
  85.  
  86. typedef union {strings s; char *c;} YYSTYPE;
  87.  
  88. #define yyclearin yychar = -1
  89. #define yyerrok yyerrflag = 0
  90. extern int yychar;
  91. extern int yyerrflag;
  92. #ifndef YYMAXDEPTH
  93. #define YYMAXDEPTH 150
  94. #endif
  95. YYSTYPE yylval, yyval;
  96. # define YYERRCODE 256
  97.  
  98. # line 351 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  99.  
  100.  
  101. extern yyparse ();
  102.  
  103. void scp_compile ()
  104. {  yyparse ();
  105. }
  106.  
  107. void yyerror (char *s) {  err_raise (err_USE, s);}
  108.  
  109. #include "scp_lex.h"
  110. int yyexca[] ={
  111. -1, 1,
  112.     0, -1,
  113.     -2, 0,
  114.     };
  115. # define YYNPROD 54
  116. # define YYLAST 115
  117. int yyact[]={
  118.  
  119.      4,    22,    23,    11,    28,    12,    13,    26,    25,    24,
  120.     19,    29,    14,    15,    16,    27,    22,    23,    11,    28,
  121.     12,    13,    26,    25,    24,    19,    29,    14,    15,    16,
  122.     27,    22,    23,    66,    28,    65,    42,    26,    25,    24,
  123.     19,    29,    43,    44,    45,    27,    22,    23,    50,    30,
  124.     46,    42,    37,    54,    35,    19,    29,    43,    44,    45,
  125.     58,    10,    59,    38,    57,    61,     3,     9,     5,     1,
  126.     60,    17,     8,     7,     6,    36,    51,    47,    20,    21,
  127.     31,    18,    41,     2,    48,     0,     0,     0,    40,    39,
  128.      0,    34,    32,    33,     0,     0,     0,    41,    49,    52,
  129.      0,    55,    56,    40,    39,    62,     0,    53,     0,     0,
  130.      0,     0,     0,    63,    64 };
  131. int yypact[]={
  132.  
  133.  -1000,  -257, -1000, -1000, -1000, -1000, -1000, -1000,  -213, -1000,
  134.  -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,  -242,  -205,
  135.   -212,  -210, -1000, -1000, -1000, -1000, -1000, -1000, -1000,  -205,
  136.  -1000,  -242, -1000, -1000,  -214,  -227,  -204, -1000, -1000, -1000,
  137.  -1000, -1000, -1000, -1000, -1000, -1000,  -205,  -205,  -202, -1000,
  138.   -205, -1000, -1000, -1000, -1000, -1000, -1000, -1000,  -205,  -205,
  139.  -1000, -1000, -1000,  -228,  -232, -1000, -1000 };
  140. int yypgo[]={
  141.  
  142.      0,    71,    83,    66,    74,    68,    81,    80,    73,    72,
  143.     79,    78,    77,    76,    63,    54,    75,    67,    61,    69 };
  144. int yyr1[]={
  145.  
  146.      0,    19,    19,     2,     2,     3,     3,     4,     4,     4,
  147.      4,     4,     4,     4,     4,     4,     5,     5,     6,     7,
  148.      8,     8,     8,     8,     8,     9,     9,    10,    11,    12,
  149.     12,    12,    12,    12,    13,    13,    14,    14,    14,    14,
  150.     14,    14,    14,     1,     1,     1,     1,     1,    15,    15,
  151.     16,    16,    17,    18 };
  152. int yyr2[]={
  153.  
  154.      0,     0,     5,     2,     3,     2,     2,     2,     2,     3,
  155.      3,     3,     3,     3,     3,     3,     2,     5,     7,     7,
  156.      7,     5,     5,     7,     5,     2,     2,     5,     7,     5,
  157.      9,     9,     5,     5,     2,     3,     2,     2,     2,     3,
  158.      3,     3,     3,     3,     2,     2,     2,     3,     1,     2,
  159.      3,     5,     3,     3 };
  160. int yychk[]={
  161.  
  162.  -1000,   -19,    -2,    -3,   257,    -5,    -4,    -8,    -9,   -17,
  163.    -18,   260,   262,   263,   269,   270,   271,    -1,    -6,   267,
  164.    -11,   -10,   258,   259,   266,   265,   264,   272,   261,   268,
  165.    262,    -7,    -8,    -4,    -9,   -15,   -16,   257,   -14,    -5,
  166.    -17,   -18,   263,   269,   270,   271,   260,   -12,   -15,    -3,
  167.    262,   -13,   -14,    -1,   257,   -15,   -15,   266,   262,   264,
  168.    272,   267,   -15,   -15,   -15,   263,   265 };
  169. int yydef[]={
  170.  
  171.      1,    -2,     2,     3,     4,     5,     6,    16,     0,     7,
  172.      8,     9,    10,    11,    12,    13,    14,    15,     0,    48,
  173.     26,    25,    52,    53,    43,    44,    45,    46,    47,    48,
  174.     17,     0,    21,    22,     0,    27,    49,    50,    24,    36,
  175.     37,    38,    39,    40,    41,    42,    48,    48,     0,    20,
  176.     48,    23,    34,    35,    51,    18,    28,    29,    48,    48,
  177.     32,    33,    19,     0,     0,    30,    31 };
  178. typedef struct { char *t_name; int t_val; } yytoktype;
  179. #ifndef YYDEBUG
  180. #    define YYDEBUG    0    /* don't allow debugging */
  181. #endif
  182.  
  183. #if YYDEBUG
  184.  
  185. yytoktype yytoks[] =
  186. {
  187.     "white_space_tok",    257,
  188.     "l_brc_tok",    258,
  189.     "r_brc_tok",    259,
  190.     "double_colon_tok",    260,
  191.     "semi_colon_tok",    261,
  192.     "l_par_tok",    262,
  193.     "r_par_tok",    263,
  194.     "l_br_tok",    264,
  195.     "r_br_tok",    265,
  196.     "operator_string_tok",    266,
  197.     "name_tok",    267,
  198.     "operator_tok",    268,
  199.     "string_tok",    269,
  200.     "char_tok",    270,
  201.     "number_tok",    271,
  202.     "special_tok",    272,
  203.     "-unknown-",    -1    /* ends search */
  204. };
  205.  
  206. char * yyreds[] =
  207. {
  208.     "-no such reduction-",
  209.     "items : /* empty */",
  210.     "items : items item",
  211.     "item : item_except_white_space",
  212.     "item : white_space_tok",
  213.     "item_except_white_space : name_stuff",
  214.     "item_except_white_space : item_except_name_stuff",
  215.     "item_except_name_stuff : l_brc",
  216.     "item_except_name_stuff : r_brc",
  217.     "item_except_name_stuff : double_colon_tok",
  218.     "item_except_name_stuff : l_par_tok",
  219.     "item_except_name_stuff : r_par_tok",
  220.     "item_except_name_stuff : string_tok",
  221.     "item_except_name_stuff : char_tok",
  222.     "item_except_name_stuff : number_tok",
  223.     "item_except_name_stuff : special",
  224.     "name_stuff : name_stuff_except_call",
  225.     "name_stuff : name_or_op l_par_tok",
  226.     "name_dc : name double_colon_tok white_space",
  227.     "name_lp : name_or_op l_par_tok white_space",
  228.     "name_stuff_except_call : name_dc name_lp item_except_white_space",
  229.     "name_stuff_except_call : name_dc name_stuff_except_call",
  230.     "name_stuff_except_call : name_dc item_except_name_stuff",
  231.     "name_stuff_except_call : name_tok white_space any_except_dclp",
  232.     "name_stuff_except_call : operator any_except_dclpsp",
  233.     "name_or_op : name",
  234.     "name_or_op : operator",
  235.     "name : name_tok white_space",
  236.     "operator : operator_tok operator_string white_space",
  237.     "operator_string : white_space operator_string_tok",
  238.     "operator_string : white_space l_par_tok white_space r_par_tok",
  239.     "operator_string : white_space l_br_tok white_space r_br_tok",
  240.     "operator_string : white_space special_tok",
  241.     "operator_string : white_space name_tok",
  242.     "any_except_dclp : any_except_dclpsp",
  243.     "any_except_dclp : special",
  244.     "any_except_dclpsp : name_stuff",
  245.     "any_except_dclpsp : l_brc",
  246.     "any_except_dclpsp : r_brc",
  247.     "any_except_dclpsp : r_par_tok",
  248.     "any_except_dclpsp : string_tok",
  249.     "any_except_dclpsp : char_tok",
  250.     "any_except_dclpsp : number_tok",
  251.     "special : operator_string_tok",
  252.     "special : r_br_tok",
  253.     "special : l_br_tok",
  254.     "special : special_tok",
  255.     "special : semi_colon_tok",
  256.     "white_space : /* empty */",
  257.     "white_space : white_spaces",
  258.     "white_spaces : white_space_tok",
  259.     "white_spaces : white_spaces white_space_tok",
  260.     "l_brc : l_brc_tok",
  261.     "r_brc : r_brc_tok",
  262. };
  263. #endif /* YYDEBUG */
  264. #line 1 "/usr/lib/yaccpar"
  265. /*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  266.  
  267. /*
  268. ** Skeleton parser driver for yacc output
  269. */
  270.  
  271. /*
  272. ** yacc user known macros and defines
  273. */
  274. #define YYERROR        goto yyerrlab
  275. #define YYACCEPT    { free(yys); free(yyv); return(0); }
  276. #define YYABORT        { free(yys); free(yyv); return(1); }
  277. #define YYBACKUP( newtoken, newvalue )\
  278. {\
  279.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  280.     {\
  281.         yyerror( "syntax error - cannot backup" );\
  282.         goto yyerrlab;\
  283.     }\
  284.     yychar = newtoken;\
  285.     yystate = *yyps;\
  286.     yylval = newvalue;\
  287.     goto yynewstate;\
  288. }
  289. #define YYRECOVERING()    (!!yyerrflag)
  290. #ifndef YYDEBUG
  291. #    define YYDEBUG    1    /* make debugging available */
  292. #endif
  293.  
  294. /*
  295. ** user known globals
  296. */
  297. int yydebug;            /* set to 1 to get debugging */
  298.  
  299. /*
  300. ** driver internal defines
  301. */
  302. #define YYFLAG        (-1000)
  303.  
  304. /*
  305. ** static variables used by the parser
  306. */
  307. static YYSTYPE *yyv;            /* value stack */
  308. static int *yys;            /* state stack */
  309.  
  310. static YYSTYPE *yypv;            /* top of value stack */
  311. static int *yyps;            /* top of state stack */
  312.  
  313. static int yystate;            /* current state */
  314. static int yytmp;            /* extra var (lasts between blocks) */
  315.  
  316. int yynerrs;            /* number of errors */
  317.  
  318. int yyerrflag;            /* error recovery flag */
  319. int yychar;            /* current input token number */
  320.  
  321.  
  322. /*
  323. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  324. */
  325. int
  326. yyparse()
  327. {
  328.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  329.     unsigned yymaxdepth = YYMAXDEPTH;
  330.  
  331.     /*
  332.     ** Initialize externals - yyparse may be called more than once
  333.     */
  334.     yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
  335.     yys = (int*)malloc(yymaxdepth*sizeof(int));
  336.     if (!yyv || !yys)
  337.     {
  338.         yyerror( "out of memory" );
  339.         return(1);
  340.     }
  341.     yypv = &yyv[-1];
  342.     yyps = &yys[-1];
  343.     yystate = 0;
  344.     yytmp = 0;
  345.     yynerrs = 0;
  346.     yyerrflag = 0;
  347.     yychar = -1;
  348.  
  349.     goto yystack;
  350.     {
  351.         register YYSTYPE *yy_pv;    /* top of value stack */
  352.         register int *yy_ps;        /* top of state stack */
  353.         register int yy_state;        /* current state */
  354.         register int  yy_n;        /* internal state number info */
  355.  
  356.         /*
  357.         ** get globals into registers.
  358.         ** branch to here only if YYBACKUP was called.
  359.         */
  360.     yynewstate:
  361.         yy_pv = yypv;
  362.         yy_ps = yyps;
  363.         yy_state = yystate;
  364.         goto yy_newstate;
  365.  
  366.         /*
  367.         ** get globals into registers.
  368.         ** either we just started, or we just finished a reduction
  369.         */
  370.     yystack:
  371.         yy_pv = yypv;
  372.         yy_ps = yyps;
  373.         yy_state = yystate;
  374.  
  375.         /*
  376.         ** top of for (;;) loop while no reductions done
  377.         */
  378.     yy_stack:
  379.         /*
  380.         ** put a state and value onto the stacks
  381.         */
  382. #if YYDEBUG
  383.         /*
  384.         ** if debugging, look up token value in list of value vs.
  385.         ** name pairs.  0 and negative (-1) are special values.
  386.         ** Note: linear search is used since time is not a real
  387.         ** consideration while debugging.
  388.         */
  389.         if ( yydebug )
  390.         {
  391.             register int yy_i;
  392.  
  393.             (void)printf( "State %d, token ", yy_state );
  394.             if ( yychar == 0 )
  395.                 (void)printf( "end-of-file\n" );
  396.             else if ( yychar < 0 )
  397.                 (void)printf( "-none-\n" );
  398.             else
  399.             {
  400.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  401.                     yy_i++ )
  402.                 {
  403.                     if ( yytoks[yy_i].t_val == yychar )
  404.                         break;
  405.                 }
  406.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  407.             }
  408.         }
  409. #endif /* YYDEBUG */
  410.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  411.         {
  412.             /*
  413.             ** reallocate and recover.  Note that pointers
  414.             ** have to be reset, or bad things will happen
  415.             */
  416.             int yyps_index = (yy_ps - yys);
  417.             int yypv_index = (yy_pv - yyv);
  418.             int yypvt_index = (yypvt - yyv);
  419.             yymaxdepth += YYMAXDEPTH;
  420.             yyv = (YYSTYPE*)realloc((char*)yyv,
  421.                 yymaxdepth * sizeof(YYSTYPE));
  422.             yys = (int*)realloc((char*)yys,
  423.                 yymaxdepth * sizeof(int));
  424.             if (!yyv || !yys)
  425.             {
  426.                 yyerror( "yacc stack overflow" );
  427.                 return(1);
  428.             }
  429.             yy_ps = yys + yyps_index;
  430.             yy_pv = yyv + yypv_index;
  431.             yypvt = yyv + yypvt_index;
  432.         }
  433.         *yy_ps = yy_state;
  434.         *++yy_pv = yyval;
  435.  
  436.         /*
  437.         ** we have a new state - find out what to do
  438.         */
  439.     yy_newstate:
  440.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  441.             goto yydefault;        /* simple state */
  442. #if YYDEBUG
  443.         /*
  444.         ** if debugging, need to mark whether new token grabbed
  445.         */
  446.         yytmp = yychar < 0;
  447. #endif
  448.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  449.             yychar = 0;        /* reached EOF */
  450. #if YYDEBUG
  451.         if ( yydebug && yytmp )
  452.         {
  453.             register int yy_i;
  454.  
  455.             (void)printf( "Received token " );
  456.             if ( yychar == 0 )
  457.                 (void)printf( "end-of-file\n" );
  458.             else if ( yychar < 0 )
  459.                 (void)printf( "-none-\n" );
  460.             else
  461.             {
  462.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  463.                     yy_i++ )
  464.                 {
  465.                     if ( yytoks[yy_i].t_val == yychar )
  466.                         break;
  467.                 }
  468.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  469.             }
  470.         }
  471. #endif /* YYDEBUG */
  472.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  473.             goto yydefault;
  474.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  475.         {
  476.             yychar = -1;
  477.             yyval = yylval;
  478.             yy_state = yy_n;
  479.             if ( yyerrflag > 0 )
  480.                 yyerrflag--;
  481.             goto yy_stack;
  482.         }
  483.  
  484.     yydefault:
  485.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  486.         {
  487. #if YYDEBUG
  488.             yytmp = yychar < 0;
  489. #endif
  490.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  491.                 yychar = 0;        /* reached EOF */
  492. #if YYDEBUG
  493.             if ( yydebug && yytmp )
  494.             {
  495.                 register int yy_i;
  496.  
  497.                 (void)printf( "Received token " );
  498.                 if ( yychar == 0 )
  499.                     (void)printf( "end-of-file\n" );
  500.                 else if ( yychar < 0 )
  501.                     (void)printf( "-none-\n" );
  502.                 else
  503.                 {
  504.                     for ( yy_i = 0;
  505.                         yytoks[yy_i].t_val >= 0;
  506.                         yy_i++ )
  507.                     {
  508.                         if ( yytoks[yy_i].t_val
  509.                             == yychar )
  510.                         {
  511.                             break;
  512.                         }
  513.                     }
  514.                     (void)printf( "%s\n", yytoks[yy_i].t_name );
  515.                 }
  516.             }
  517. #endif /* YYDEBUG */
  518.             /*
  519.             ** look through exception table
  520.             */
  521.             {
  522.                 register int *yyxi = yyexca;
  523.  
  524.                 while ( ( *yyxi != -1 ) ||
  525.                     ( yyxi[1] != yy_state ) )
  526.                 {
  527.                     yyxi += 2;
  528.                 }
  529.                 while ( ( *(yyxi += 2) >= 0 ) &&
  530.                     ( *yyxi != yychar ) )
  531.                     ;
  532.                 if ( ( yy_n = yyxi[1] ) < 0 )
  533.                     YYACCEPT;
  534.             }
  535.         }
  536.  
  537.         /*
  538.         ** check for syntax error
  539.         */
  540.         if ( yy_n == 0 )    /* have an error */
  541.         {
  542.             /* no worry about speed here! */
  543.             switch ( yyerrflag )
  544.             {
  545.             case 0:        /* new error */
  546.                 yyerror( "syntax error" );
  547.                 goto skip_init;
  548.             yyerrlab:
  549.                 /*
  550.                 ** get globals into registers.
  551.                 ** we have a user generated syntax type error
  552.                 */
  553.                 yy_pv = yypv;
  554.                 yy_ps = yyps;
  555.                 yy_state = yystate;
  556.                 yynerrs++;
  557.             skip_init:
  558.             case 1:
  559.             case 2:        /* incompletely recovered error */
  560.                     /* try again... */
  561.                 yyerrflag = 3;
  562.                 /*
  563.                 ** find state where "error" is a legal
  564.                 ** shift action
  565.                 */
  566.                 while ( yy_ps >= yys )
  567.                 {
  568.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  569.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  570.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  571.                         /*
  572.                         ** simulate shift of "error"
  573.                         */
  574.                         yy_state = yyact[ yy_n ];
  575.                         goto yy_stack;
  576.                     }
  577.                     /*
  578.                     ** current state has no shift on
  579.                     ** "error", pop stack
  580.                     */
  581. #if YYDEBUG
  582. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  583.                     if ( yydebug )
  584.                         (void)printf( _POP_, *yy_ps,
  585.                             yy_ps[-1] );
  586. #    undef _POP_
  587. #endif
  588.                     yy_ps--;
  589.                     yy_pv--;
  590.                 }
  591.                 /*
  592.                 ** there is no state on stack with "error" as
  593.                 ** a valid shift.  give up.
  594.                 */
  595.                 YYABORT;
  596.             case 3:        /* no shift yet; eat a token */
  597. #if YYDEBUG
  598.                 /*
  599.                 ** if debugging, look up token in list of
  600.                 ** pairs.  0 and negative shouldn't occur,
  601.                 ** but since timing doesn't matter when
  602.                 ** debugging, it doesn't hurt to leave the
  603.                 ** tests here.
  604.                 */
  605.                 if ( yydebug )
  606.                 {
  607.                     register int yy_i;
  608.  
  609.                     (void)printf( "Error recovery discards " );
  610.                     if ( yychar == 0 )
  611.                         (void)printf( "token end-of-file\n" );
  612.                     else if ( yychar < 0 )
  613.                         (void)printf( "token -none-\n" );
  614.                     else
  615.                     {
  616.                         for ( yy_i = 0;
  617.                             yytoks[yy_i].t_val >= 0;
  618.                             yy_i++ )
  619.                         {
  620.                             if ( yytoks[yy_i].t_val
  621.                                 == yychar )
  622.                             {
  623.                                 break;
  624.                             }
  625.                         }
  626.                         (void)printf( "token %s\n",
  627.                             yytoks[yy_i].t_name );
  628.                     }
  629.                 }
  630. #endif /* YYDEBUG */
  631.                 if ( yychar == 0 )    /* reached EOF. quit */
  632.                     YYABORT;
  633.                 yychar = -1;
  634.                 goto yy_newstate;
  635.             }
  636.         }/* end if ( yy_n == 0 ) */
  637.         /*
  638.         ** reduction by production yy_n
  639.         ** put stack tops, etc. so things right after switch
  640.         */
  641. #if YYDEBUG
  642.         /*
  643.         ** if debugging, print the string that is the user's
  644.         ** specification of the reduction which is just about
  645.         ** to be done.
  646.         */
  647.         if ( yydebug )
  648.             (void)printf( "Reduce by (%d) \"%s\"\n",
  649.                 yy_n, yyreds[ yy_n ] );
  650. #endif
  651.         yytmp = yy_n;            /* value to switch over */
  652.         yypvt = yy_pv;            /* $vars top of value stack */
  653.         /*
  654.         ** Look in goto table for next state
  655.         ** Sorry about using yy_state here as temporary
  656.         ** register variable, but why not, if it works...
  657.         ** If yyr2[ yy_n ] doesn't have the low order bit
  658.         ** set, then there is no action to be done for
  659.         ** this reduction.  So, no saving & unsaving of
  660.         ** registers done.  The only difference between the
  661.         ** code just after the if and the body of the if is
  662.         ** the goto yy_stack in the body.  This way the test
  663.         ** can be made before the choice of what to do is needed.
  664.         */
  665.         {
  666.             /* length of production doubled with extra bit */
  667.             register int yy_len = yyr2[ yy_n ];
  668.  
  669.             if ( !( yy_len & 01 ) )
  670.             {
  671.                 yy_len >>= 1;
  672.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  673.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  674.                     *( yy_ps -= yy_len ) + 1;
  675.                 if ( yy_state >= YYLAST ||
  676.                     yychk[ yy_state =
  677.                     yyact[ yy_state ] ] != -yy_n )
  678.                 {
  679.                     yy_state = yyact[ yypgo[ yy_n ] ];
  680.                 }
  681.                 goto yy_stack;
  682.             }
  683.             yy_len >>= 1;
  684.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  685.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  686.                 *( yy_ps -= yy_len ) + 1;
  687.             if ( yy_state >= YYLAST ||
  688.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  689.             {
  690.                 yy_state = yyact[ yypgo[ yy_n ] ];
  691.             }
  692.         }
  693.                     /* save until reenter driver code */
  694.         yystate = yy_state;
  695.         yyps = yy_ps;
  696.         yypv = yy_pv;
  697.     }
  698.     /*
  699.     ** code supplied by user is placed in this switch
  700.     */
  701.     switch( yytmp )
  702.     {
  703.         
  704. case 2:
  705. # line 141 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  706. {  cout << yypvt[-0].s; } break;
  707. case 4:
  708. # line 146 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  709. {  yyval.s=strings::make(yypvt[-0].c); } break;
  710. case 9:
  711. # line 156 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  712. {  yyval.s=strings::make(yypvt[-0].c); } break;
  713. case 10:
  714. # line 158 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  715. {  yyval.s=strings::make(yypvt[-0].c); } break;
  716. case 11:
  717. # line 160 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  718. {  yyval.s=strings::make(yypvt[-0].c); } break;
  719. case 12:
  720. # line 162 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  721. {  yyval.s=strings::make(yypvt[-0].c); } break;
  722. case 13:
  723. # line 164 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  724. {  yyval.s=strings::make(yypvt[-0].c); } break;
  725. case 14:
  726. # line 166 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  727. {  yyval.s=strings::make(yypvt[-0].c); } break;
  728. case 15:
  729. # line 168 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  730. {  yyval.s=strings::make(yypvt[-0].c); } break;
  731. case 17:
  732. # line 173 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  733. {  yyval.s = yypvt[-1].s + strings::make(yypvt[-0].c); } break;
  734. case 18:
  735. # line 177 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  736. {  yyval.s = yypvt[-2].s + strings::make(yypvt[-1].c) + yypvt[-0].s; } break;
  737. case 19:
  738. # line 181 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  739. {  yyval.s = yypvt[-2].s + strings::make(yypvt[-1].c) + yypvt[-0].s; } break;
  740. case 20:
  741. # line 186 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  742.       sos_String cn = smg_String (yypvt[-2].s[0]).make_String (TEMP_CONTAINER);
  743.       sos_Schema_type tp = scp_mdl.lookup_type (cn, TRUE);
  744.       cn.destroy();
  745.       sos_Bool is_static;
  746.       sos_Bool is_protected;
  747.       sos_Bool is_sos_method = (sos_Bool)(tp != NO_OBJECT
  748.                       AND tp.has_type (sos_Class_type_type));
  749.       if (streql (yypvt[-1].s[0], "operator"))
  750.      is_static = FALSE;
  751.       else if (is_sos_method)
  752.       {  sos_String mn = smg_String (yypvt[-1].s[0]).make_String (TEMP_CONTAINER);
  753.      sos_Method_List ml =
  754.         sos_Class_type::make(tp).get_inherited_methods()[mn];
  755.      mn.destroy();
  756.      if (ml == NO_OBJECT)
  757.      {  is_static    = TRUE;
  758.         is_protected = FALSE;
  759.      }
  760.      else
  761.      {  sos_Method m = ml.get_nth(1);
  762.         is_static    = m.get_is_static();
  763.         is_protected = (sos_Bool)(m.get_kind() EQ sos_PROTECTED);
  764.      }
  765.       }
  766.       strings result;
  767.       if (is_sos_method)
  768.       {  if ((is_static AND nesting != 0 AND NOT is_protected)  // 25.8.91 (dt)
  769.          OR global_var_init)                 // 09.07.91 (bs)
  770.         result = yypvt[-2].s + yypvt[-1].s;
  771.      else
  772.      {  if (streql (yypvt[-1].s[0], "operator"))
  773.         {  delete yypvt[-1].s[0];
  774.            yypvt[-1].s[0] = strdup ("");
  775.            sos_String mn = smg_String (yypvt[-1].s[1]).make_String (TEMP_CONTAINER);
  776.            sos_String on = cci_Method_impl::operator_string (mn);
  777.            yypvt[-1].s[1] = on.make_Cstring();
  778.            on.destroy();
  779.            mn.destroy();
  780.         }
  781.         result = strings::make (strdup ("_")) + yypvt[-2].s + yypvt[-1].s;
  782.      }
  783.      if (NOT is_static)
  784.      {  if (nesting == 0)
  785.         {  in_method_of_sos_class = strdup (yypvt[-2].s[0]);
  786.            result = result +
  787.             strings::make (strdup ("sos_Typed_id &_tpid"));
  788.         }
  789.         else
  790.            result = result + strings::make (strdup ("_tpid"));
  791.         if (NOT streql (yypvt[-0].s[0], ")"))
  792.            result = result + strings::make (strdup (","));
  793.      }
  794.      result = result + yypvt[-0].s;
  795.       }
  796.       else
  797.      result = yypvt[-2].s + yypvt[-1].s + yypvt[-0].s;
  798.       yyval.s = result;
  799.    } break;
  800. case 21:
  801. # line 246 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  802. {  yyval.s = yypvt[-1].s + yypvt[-0].s; } break;
  803. case 22:
  804. # line 248 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  805. {  yyval.s = yypvt[-1].s + yypvt[-0].s; } break;
  806. case 23:
  807. # line 250 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  808. {  if (streql (yypvt[-2].c, "self") AND in_method_of_sos_class != 0)
  809.     {  delete yypvt[-2].c;
  810.        yyval.s = strings::make (strdup (in_method_of_sos_class)) +
  811.         strings::make (strdup ("::make(_tpid,this)")) + yypvt[-1].s + yypvt[-0].s;
  812.     }
  813.         else
  814.        yyval.s = strings::make(yypvt[-2].c) + yypvt[-1].s + yypvt[-0].s;
  815.      } break;
  816. case 24:
  817. # line 259 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  818. {  yyval.s = yypvt[-1].s + yypvt[-0].s; } break;
  819. case 27:
  820. # line 267 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  821. {  yyval.s = strings::make(yypvt[-1].c) + yypvt[-0].s; } break;
  822. case 28:
  823. # line 271 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  824. {  yyval.s = strings::make(yypvt[-2].c) + yypvt[-1].s + yypvt[-0].s; } break;
  825. case 29:
  826. # line 276 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  827. {  yyval.s = strings::make (yypvt[-0].c) + yypvt[-1].s; } break;
  828. case 30:
  829. # line 278 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  830. {  yyval.s = strings::make (strdup ("()")) + yypvt[-3].s + yypvt[-1].s;
  831.           delete yypvt[-2].c;
  832.           delete yypvt[-0].c;
  833.        } break;
  834. case 31:
  835. # line 283 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  836. {  yyval.s = strings::make (strdup ("[]")) + yypvt[-3].s + yypvt[-1].s;
  837.           delete yypvt[-2].c;
  838.           delete yypvt[-0].c;
  839.        } break;
  840. case 32:
  841. # line 288 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  842. {  yyval.s = strings::make (yypvt[-0].c) + yypvt[-1].s; } break;
  843. case 33:
  844. # line 290 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  845. {  yyval.s = strings::make (yypvt[-0].c) + yypvt[-1].s; } break;
  846. case 35:
  847. # line 295 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  848. {  yyval.s=strings::make(yypvt[-0].c); } break;
  849. case 39:
  850. # line 302 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  851. {  yyval.s=strings::make(yypvt[-0].c); } break;
  852. case 40:
  853. # line 304 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  854. {  yyval.s=strings::make(yypvt[-0].c); } break;
  855. case 41:
  856. # line 306 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  857. {  yyval.s=strings::make(yypvt[-0].c); } break;
  858. case 42:
  859. # line 308 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  860. {  yyval.s=strings::make(yypvt[-0].c); } break;
  861. case 43:
  862. # line 312 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  863. {  // 09.07.91 (bs)
  864.              if ((nesting == 0) AND ((*yypvt[-0].c) == '='))
  865.          global_var_init = TRUE;
  866.       } break;
  867. case 47:
  868. # line 320 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  869. {  // 09.07.91 (bs)
  870.          global_var_init = FALSE;
  871.        } break;
  872. case 48:
  873. # line 325 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  874. {  yyval.s = strings::make (strdup ("")); } break;
  875. case 50:
  876. # line 330 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  877. {  yyval.s = strings::make(yypvt[-0].c); } break;
  878. case 51:
  879. # line 332 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  880. {  yyval.s = yypvt[-1].s + strings::make(yypvt[-0].c); } break;
  881. case 52:
  882. # line 336 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  883. {  nesting++;
  884.        yyval.s=strings::make(yypvt[-0].c);
  885.     } break;
  886. case 53:
  887. # line 342 "/fzi/prost/stone/SOS3-2/src/scp/scp.y"
  888. {  nesting--;
  889.        yyval.s=strings::make(yypvt[-0].c);
  890.        if (nesting == 0)
  891.        {  delete in_method_of_sos_class;
  892.           in_method_of_sos_class = 0;
  893.        }
  894.     } break;
  895.     }
  896.     goto yystack;        /* reset registers in driver code */
  897. }
  898.